home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / lcad341.zip / LC.LSP < prev    next >
Lisp/Scheme  |  1991-01-26  |  3KB  |  105 lines

  1.  
  2. ; LaunchCAD Autolisp program version 3.4
  3.  
  4. ; Note: add the line:     (load"lc")     to the end of your ACAD.LSP file.
  5. ; If you do not have an ACAD.LSP file then you can rename this file to ACAD.LSP
  6. ; or add the contents of this file to your present ACAD.LSP file.
  7.  
  8. (princ "\nLoading LaunchCAD...")
  9. (defun lc_shell (mode dt / ce dir f)        ; call LaunchCAD in shell mode
  10.   (setq ce (getvar "CMDECHO"))
  11.   (setvar "CMDECHO" 0)                          ; don't echo commands
  12.   (if (= dt "s") (progn
  13.     (if(="11"(substr(getvar "ACADVER")1 2))
  14.       (setq dir ".")
  15.       (setq dir (getvar "ACADPREFIX")))
  16.   )
  17.     (setq dir (getvar "DWGPREFIX"))
  18.   )
  19.   (if (null dir) (setq dir "."))
  20. ; (command "sh" "mode co80")                    ; decomment for dual screen
  21.   (command "launchcad" (strcat dir " " mode))   ; invoke LaunchCAD
  22. ; (command "sh" "mode mono")                    ; decomment for dual screen
  23. ; (graphscr)                    ;    "           "
  24.   (command "script" "lc")                       ; run the script
  25.   (if(setq f(open(findfile "lc.scr")"w"))       ; just in case...
  26.        (close f))                ; empty script file.
  27.   (setvar "CMDECHO" ce)                         ; restore CMDECHO
  28.   (princ)
  29. )
  30.  
  31. ; Note: You may edit this lisp file to rename the following functions
  32. ; to any name that you wish so long as it does not conflict with an
  33. ; AutoCAD internal command.
  34.  
  35. ; Execute LaunchCAD from within AutoCAD (in shell mode)
  36.  
  37. (defun c:lc ()  (lc_shell "shell" "d"))
  38.  
  39. ; Insert Mode
  40. (defun c:ins ()  (lc_shell "insert" "d"))
  41.  
  42. ; Lisp Mode
  43. (defun c:lisp ()  (lc_shell "lisp" "s"))
  44.  
  45. ; DXFIN Mode
  46. (defun c:dxf ()  (lc_shell "dxfin" "s"))
  47.  
  48. ; DXBIN Mode
  49. (defun c:dxb ()  (lc_shell "dxbin" "s"))
  50.  
  51. ; VSlide Mode
  52. (defun c:vs ()    (lc_shell "vslide" "s"))
  53.  
  54. ; Menu Mode
  55. (defun c:mu ()    (lc_shell "menu" "s"))
  56.  
  57. ; File Mode
  58. (defun fi ()
  59.   (command "launchcad" ". file" )        ; invoke LaunchCAD
  60.   (princ)
  61. )
  62.  
  63. ; Redefine the QUIT command to run quit.scr in order to
  64. ; bypass the AutoCAD opening menu.
  65.  
  66. (defun c:quit ()
  67.   (setvar "CMDECHO" 0)
  68.   (initget "No Yes")
  69.   (if(= "Yes" (getkword
  70.     "\nDo you really want to discard\nall changes to drawing[y/N]: "))
  71.     (command "script" "quit"))
  72.   (princ)
  73. )
  74.  
  75. ; Redefine the END command to run end.scr in order to
  76. ; bypass the AutoCAD opening menu.
  77.  
  78. (defun c:end ()
  79.   (setvar "CMDECHO" 0)
  80.   (command "script" "end")              ; run end.scr which bypasses menu
  81.   (princ)
  82. )
  83.  
  84. (defun c:wend ()
  85.   (setvar "CMDECHO" 0)
  86.   (command "script" "wend")              ; run wend.scr which saves drawing
  87.   (princ)                 ; using wblock * and bypasses menu
  88. )
  89.  
  90. ; Undefine the AutoCAD drawing editor END and QUIT commands so that
  91. ; the end and quit functions defined above will work in place of the
  92. ; internal commands (.end and .quit will still work like normal)
  93.  
  94. (defun lc:su()
  95.   (command "UNDEFINE" "QUIT")
  96.   (command "UNDEFINE" "END")
  97.   (princ "\nEND and QUIT commands redefined...")
  98.   (princ "\nLaunchCAD initialized.")
  99.   (princ)
  100. )
  101.  
  102. (princ "\nLaunchCAD loaded.")
  103. (princ)
  104.  
  105.